home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 August / August CD.bin / Shareware / Education / numericalmethods Folder / chap_5 / tp.m < prev    next >
Encoding:
Text File  |  1994-06-05  |  366 b   |  14 lines  |  [MATF/MATL]

  1. function z = tp(A,B,t,m)
  2. % z = tp(A,B,t,m)
  3. % Evaluates the trigonometric polynomial created with tpcoeff.m
  4. % A coefficients of cos(nx), input.
  5. % B coefficients of sin(nx), input.
  6. % t is the variable, input.
  7. % m degree of the trigonomitric polynomial, input.
  8. % z is the function value, output.
  9. z = A(1);
  10. for j = 1:m,
  11.   z = z + A(j+1)*cos(j*t) + B(j+1)*sin(j*t);
  12. end
  13.  
  14.